
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
from numpy.lib.function_base import average
from test.test_iterlen import len
import string as str

class Get_Feature_List:

    # the format of list:ASIN,feature
    def get_infolist(self):
        file_object = open(file_name() , 'r');
        ASIN_info = ''
        other_info={}
        list = []
    
        for line in file_object:
            splitInfo = line.split('    ' )
            if len(splitInfo)==1:
                ASIN_info = splitInfo[0]
            else:
                feature_list = []
                for i in range(1,len(splitInfo)-1):
                    feature_list.append(splitInfo[i])
                list.append({'ASIN':ASIN_info,'feature':feature_list})
                ASIN_info=''    
        return list

def file_name():
        return '../txt_package/women_jeans_feature.txt'   
    
if __name__ == '__main__':
    G = Get_Feature_List()
    G.get_infolist()